<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>查询快件</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="css/font.css">
    <link rel="stylesheet" href="css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/xadmin.js"></script>
    <script type="text/javascript" src="js/cookie.js"></script>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
</head>
<body>
<!--通过包裹ID查找该包裹内的快件信息-->
<script>
    function status(num){
        if(num === 0){
            return "新建";
        }
        else if(num === 1){
            return "揽收";
        }
        else if(num === 2){
            return "分拣";
        }
        else if(num === 3){
            return "转运";
        }
        else if(num === 4){
            return "派送";
        }
        else if(num === 5){
            return "交付";
        }
    }
    $(function(){
        $("#submit").click(function () {
            var str="http://localhost:8080/es/getEsFormPakcage/"+$("#input").val();
            $.ajax({
                url:str,
                type:"GET",
                dataType:'JSON',
                contentType : "application/json; charset=utf-8",
                success:function(data){
                    var obj = data;
                    if(obj.code.code === 0){
                        var list=obj.esList;
                        $("#numspan").text("显示数据："+list.length+"条");
                        var tableData;
                        for(var i=0;i<list.length;i++){
                            tableData+="<tr> " +
                                "<td>"+list[i].id +"</td> " +
                                "<td>"+list[i].type +"</td> " +
                                "<td>"+list[i].sender.name +"</td>" +
                                "<td>"+list[i].recever.name +"</td>" +
                                // "<td>"+list[i].weight +" </td>" +
                                // "<td>"+list[i].tranFee +"</td>" +
                                // "<td>"+list[i].packageFee +"</td>" +
                                // "<td>"+list[i].insuFee +"</td> "+
                                "<td>"+list[i].accepter +"</td> "+
                                "<td>"+list[i].deliver +"</td> "+
                                "<td>"+list[i].accepteTime +"</td> "+
                                "<td>"+list[i].deliveTime +"</td> "+
                                // "<td>"+list[i].acc1 +"</td> "+
                                // "<td>"+list[i].acc2 +"</td> "+
                                "<td>"+status(list[i].status)+"</td> "+
                                "</tr>";
                        }
                        $("#firsttbody").html(tableData);
                    }
                    else{
                        alert(obj.code.message);
                    }
                },
                error:function(){
                    alert("error");
                }
            });
        });
    });
</script>
<div class="x-nav">
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">刷新</i>
    </a>
</div>
<div class="x-body">
    <div class="layui-row" style="margin-left: 550px">
        <form class="layui-form layui-col-md12 x-so" method="#">
            <input id="input" class="layui-input" type="text" name="customername" placeholder="请输入包裹单号" autocomplete="off" value="">
            <button class="layui-btn" id="submit" type="button"><i class="layui-icon">&#xe615;</i></button>
        </form>
    </div>
    <xblock>
        <span id="numspan" class="x-right" style="line-height:40px">共有数据：0 条</span>
    </xblock>
    <table class="layui-table">
        <thead>
        <tr>
            <th>快递单号</th>
            <th>类型</th>
            <th>寄件人</th>
            <th>收件人</th>
            <!--<th>重量</th>-->
            <!--<th>运费</th>-->
            <!--<th>包装费</th>-->
            <!--<th>保险费</th>-->
            <th>揽收人</th>
            <th>交付人</th>
            <th>揽收时间</th>
            <th>交付时间</th>
            <!--<th>寄件附件</th>-->
            <!--<th>收件附件</th>-->
            <th>快递状态</th>
        </tr>
        </thead>
        <tbody id="firsttbody">

        </tbody>
    </table>
</div>
</body>
</html>